package com.entity;

import com.alibaba.fastjson.JSONObject;
import com.util.VeDate;

public class User {
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    private String id = "U" + VeDate.getStringId(); // 生成主键编号
    private String username; // 用户名
    private String password; // 密码

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    private String realname; // 姓名
    private String tel;
    private String sex; // 联系方式
    private String age; //
    private String type;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }



    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRealname() {
        return realname;
    }

    public void setRealname(String realname) {
        this.realname = realname;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }





    @Override
    public String toString() {
        return this.toJsonString();
    }

    // 直接转换成JSON字符串
    private String toJsonString() {
        JSONObject jsonString = new JSONObject();
        jsonString.put("id", this.id); // 编号
        jsonString.put("username", this.username); // 用户名
        jsonString.put("password", this.password); // 密码
        jsonString.put("realname", this.realname); // 姓名
        jsonString.put("tel", this.tel);// 联系方式
        jsonString.put("age", this.age); //年龄
        jsonString.put("sex", this.sex); // 性别
        jsonString.put("type", this.type);// 类型
        return jsonString.toString();
    }

}
